﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using Zzt.ExpertsCore.Domain.Entities;

namespace Zzt.ExpertsCore.Domain.Repository
{
    public interface IUnitOfWork : IDisposable
    {
        void Commit();
        void Rollback();

        Task<IEnumerable<TModel>> QueryModel<TModel>(string cmd, object[] parameters);
        Task<TModel> QueryModelFirstOrDefault<TModel>(string cmd, object[] parameters);
        IDbTransaction Transaction { get; }
        string BuildTableName<TEntity>() where TEntity : BaseEntity;
    }
}